/*
**************************************************************************************
*Myriad Engine                                                                       *
*Copyright (C) 2006-2007, 5d Studios (www.5d-Studios.com)                            *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library is distributed in the hope that it will be useful,                     *
*but WITHOUT ANY WARRANTY; without even the implied warranty of                      *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
package leola.backend.interpreter;

import java.util.Stack;

import leola.types.LeoObject;

/**
 * The Stacks entry
 * 
 * @author Tony
 *
 */
public class StackFrame {

	public enum ControlFlowType {
		BREAK,
		CONTINUE,
		RETURN,
		
		NONE
	}
	
	/**
	 * The frames pointer
	 */
	private int framePointer;
	
	/**
	 * Scope
	 */
	private Scope scope;
	
	/**
	 * The object
	 */
	private java.util.Stack<LeoObject> localStack;
	
	/**
	 * Control flow
	 */
	private ControlFlowType type;

	/**
	 * @param framePointer
	 */
	public StackFrame(int framePointer) {
		this(framePointer, new Scope(true), ControlFlowType.NONE);
	}
	
	/**
	 * @param framePointer
	 * @param scope
	 */
	public StackFrame(int framePointer, Scope scope) {
		this(framePointer,scope, ControlFlowType.NONE);
	}
		
	/**
	 * @param framePointer
	 * @param scope
	 * @param object
	 * @param type
	 */
	public StackFrame(int framePointer, Scope scope, 
			ControlFlowType type) {
		this.framePointer = framePointer;
		this.scope = scope;
		this.type = type;
		
		this.localStack = new java.util.Stack<LeoObject>();
	}

	/**
	 * @return the framePointer
	 */
	public int getFramePointer() {
		return framePointer;
	}

	/**
	 * @param framePointer the framePointer to set
	 */
	public void setFramePointer(int framePointer) {
		this.framePointer = framePointer;
	}

	/**
	 * @return the scope
	 */
	public Scope getScope() {
		return scope;
	}

	/**
	 * @param scope the scope to set
	 */
	public void setScope(Scope scope) {
		this.scope = scope;
	}

	/**
	 * @return the localStack
	 */
	public Stack<LeoObject> getLocalStack() {
		return localStack;
	}
	
	/**
	 * @return the type
	 */
	public ControlFlowType getType() {
		return type;
	}
	
	/**
	 * @param type the type to set
	 */
	public void setType(ControlFlowType type) {
		this.type = type;
	}
	
}
